/**
 * 检查修改密码
 * param oForm
 * returns {boolean}
 */
function checkPass(oForm) {
    var oldpassword = $(oForm).find('#oldpassword').val();
    if(oldpassword.length <6 ){
        layerMsg('旧密码不能为空,或者不能少于6位!', 2);
        $(oForm).find('#oldpassword').focus();
        return false;
    }else{
        $.ajax({
            url: '/mobile/company/ajax_pass',
            dataType: "json",
            data: {//要传递的数据
                oldpassword: $(oForm).find('#oldpassword').val(),
                _token: _token
            },
            type: "POST",
            success: function (data) {
                if(data.status == '1'){
                    layerMsg(data.msg,2);
                    return false;
                }else{
                    var password = $(oForm).find('#password').val();
                    if(password.length <6 ){
                        layerMsg('新密码不能为空,或者不能少于6位!', 2);
                        $(oForm).find('#password').focus();
                        return false;
                    }
                    var password_confirmation = $(oForm).find('#password_confirmation').val();
                    if(password_confirmation != password ){
                        layerMsg('两次密码输入不一致!', 2);
                        $(oForm).find('#password_confirmation').focus();
                        return false;
                    }
                    var serialize = $(oForm).serialize();
                    $.ajax({
                        url: '/mobile/company/post_mod_password',
                        dataType: "json",
                        data: serialize,
                        type: "POST",
                        beforeSend: function () {
                            $(oForm).find("input[type='submit']").val('请稍候...');
                            $(oForm).find("input[type='submit']").attr('disabled', true);
                        },
                        success: function (data) {
                            if(data.status == '1'){
                                layerMsg(data.msg,2);
                                $(oForm).find("input[type='submit']").val('保存');
                                $(oForm).find("input[type='submit']").removeAttr('disabled');
                                return false;
                            }else if(data.status == '0'){
                                layerMsg(data.msg,0);
                                location = '/mobile/company/welcome';
                            }
                        },
                        error: function (data) {
                            var msgErr='';
                            var errors = $.parseJSON(data.responseText);
                            $.each(errors, function(index, value) {
                                msgErr += "<p style='line-height: .4rem; width: 100%'>"+ value+";</p>";
                            });
                            layerMsg(msgErr,2);
                            $(oForm).find("input[type='submit']").val('保存');
                            $(oForm).find("input[type='submit']").removeAttr('disabled');
                            return false;
                        }
                    });
                }
            },
            error: function (data) {
                layerMsg('可能是网络原因引起的错误！',2);
                return false;
            }
        });
    }
    return false;
}